import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CategoryPage extends StatefulWidget{
  const CategoryPage({super.key});

  @override
  State<StatefulWidget> createState()  => CategoryState();

}

class CategoryState extends State<CategoryPage>{
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: double.infinity,
      //CustomScrollView 可以设定不同的sliver，sliver可以是任意widget，如列表、网格、固定头部
      child: CustomScrollView(
        slivers: [
          SliverToBoxAdapter(child: Container(
            alignment: Alignment.centerLeft,
            width: double.infinity,
            height: 20,
            color: Colors.white,
            child: Text("tab bar"),
          ),),
          SliverToBoxAdapter(child: Container(
            alignment: Alignment.centerLeft,
            width: double.infinity,
            height: 100,
            color: Colors.yellow,
            child: Text("轮播图"),
          ),),
          SliverList.separated(itemBuilder: (BuildContext context,int index){
            return Container(
              alignment: Alignment.centerLeft,
              width: double.infinity,
              height: 50,
              color: Colors.white,
              child: Text("index $index"),
            );
          }, separatorBuilder: (BuildContext context,int index){
            return Container(
              width: double.infinity,
              height: 1,
              color: Colors.black,
            );
          }, itemCount: 100)
        ],
      ),
    );
  }

}